<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

if ( ! function_exists('get_promotions'))
{
	function get_promotions()
	{
		$CI =& get_instance();
		
		$CI->load->model('product_model');
		
		$products_promo = $CI->product_model->getAll(array('promotion' => 1, 'language_id' => $CI->config->item('lang_obj')->id))->result();

		return $products_promo;	
	}
}

if ( ! function_exists('get_questions'))
{
	function get_questions()
	{
		$CI =& get_instance();
		
		$CI->load->model('questions_model');
		
		$questions = $CI->questions_model->getAnswered(array('language_id' => $CI->config->item('lang_obj')->id, 'limit' => 3))->result();
		
		return $questions;	
	}
}

if ( ! function_exists('get_opinions'))
{
	function get_opinions()
	{
		$CI =& get_instance();

		$CI->load->model('opinion_model');

		$opinions = $CI->opinion_model->getOpinion(array('language_id' => $CI->config->item('lang_obj')->id, 'limit' => 3))->result();

		return $opinions;
	}
}

if ( ! function_exists('getLiveProduct'))
{
	function getLiveProduct()
	{
		$CI =& get_instance();

		$CI->load->model('live_view_model');
		$CI->db->cache_off();
		$products_live = $CI->live_view_model->getLiveProduct(array('language_id' => $CI->config->item('lang_obj')->id, 'limit' => 2))->result();
		$CI->db->cache_on();
		return $products_live;
	}
}
